<html>
	<head>
		<script type="text/javascript" src="Animate.js"></script>
		<script type="text/javascript" src="Resource.js"></script>
		<script type="text/javascript" src="Legion.js"></script>
		<script type="text/javascript" src="../../../tools/PxLoader/PxLoader.js"></script>
		<script type="text/javascript" src="../../../tools/PxLoader/PxLoaderImage.js"></script>
		<script type="text/javascript">
			var animate;
			var context;
			var obj;
			var legion;
			function testAnimate() {
				obj = {};
				obj.frameRate = 24;
				obj.frames = 5;
				obj.x = 600;
				obj.y = 500;
				
				
				context = document.getElementById("canvas").getContext("2d");

				var loader = new PxLoader();
				obj.img =loader.addImage("../images/fight/hubao.png");
				
				loader.onError(function(res) {
					console.log(res);
				});

				loader.addCompletionListener(function(){
					animate = new Animate(obj);
					setInterval(drawHubao,100);
				}); 

				loader.start();
				
			}

			function testLegion() {
				obj = {};
				obj.x = 100;
				obj.y = 100;
				obj.row = 3;
				obj.col = 3;
				context = document.getElementById("canvas").getContext("2d");
				legion = new Legion(obj);
				setInterval(drawLegion,200);
				//drawLegion();
				
			}

			function drawLegion() {
				context.fillRect(0,0,document.getElementById("canvas").width,document.getElementById("canvas").height);
				legion.enterFrame(20/1000);
				legion.draw(context);
			}

			function drawHubao() {
				context.fillRect(0,0,document.getElementById("canvas").width,document.getElementById("canvas").height);
				//context.drawImage(obj.img,0,0,100,100,600,200,100,100);
				//context.drawImage(obj.img,0,0);
				animate.enterFrame(200/1000);
				animate.draw(context);
			}
		</script>
	</head>

	<input type="submit" value="animate" onClick="testAnimate();"/></br></br>
	<input type="submit" value="testLegion" onClick="testLegion();"/>
	
	<img id="hubao" src="../images/fight/hubao.png"/>

	<canvas id="canvas" width="1000" height="600">
	</canvas>
<html>